package com.lambda.plugin


import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.jetbrains.annotations.NotNull

@SuppressWarnings("unused")
class UploadAPKPlugin implements Plugin<Project> {
    @Override
    void apply(@NotNull Project project) {
        UploadConfig config = project.extensions.create("uploadConfig", UploadConfig.class)

        project.tasks.whenObjectAdded { Task task ->
            final String taskName = task.name
            if (taskName.startsWith("assemble") && taskName.endsWith("Release")) {
                task.doLast(new URLUpload(config))
            }
        }
    }
}
